
package org.codebase.spring.framework.base.reflect;

import java.lang.reflect.Constructor;

import org.codebase.spring.framework.base.bean.Demo;

public class CreateBean {

    public static Object instantiate(String beanClass) throws Exception {
        Class<?> c = Class.forName(beanClass);
        Constructor<?> cstor = c.getDeclaredConstructor();
        return cstor.newInstance();
    }

    public static void main(String[] args) throws Exception {
        Demo demo = (Demo) CreateBean.instantiate("org.codebase.spring.framework.base.bean.Demo");
        demo.play1();
    }
}
